<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>date</title>
	</head>
	<body>
		<button id="btn1">开始计时</button>
		<button id="btn2">暂停计时</button>
		<button id="btn3">结束计时</button>
		<div id="div1"></div>
		<div id="div2"></div>
		<script>
			
			btn1.onclick = fun1;
			btn2.onclick = fun3;
			btn3.onclick = fun4;
			// 计时两分钟
			var count1;
			var num = 0;
			var s=0;
			function fun1() {
				count1 = setInterval(fun2,100);
				
			}
			function fun3 () {
				clearInterval(count1);
			}
			function fun4 () {
				clearInterval(count1);
				num=0;
				s=0;
				div1.innerHTML = s + ":"+num;
			}
			
			function fun2() {
				num++;
				if(num>=60){
					s++;
					num=0;
				}
				div1.innerHTML = s + ":"+num;
				/* if(s>=2){
					clearInterval(count1);
					div2.innerHTML = "计时结束";
				} */
			}
		</script>
	</body>
</html>